import 'package:flutter/material.dart';
import 'package:lottie/lottie.dart';

class AePage extends StatefulWidget {
  const AePage({Key? key}) : super(key: key);

  @override
  _AePageState createState() => _AePageState();
}

class _AePageState extends State<AePage> with SingleTickerProviderStateMixin {
  late final _controller;
  @override
  void initState() {
    _controller = AnimationController(vsync: this);
    super.initState();
  }

  @override
  void dispose() {
    _controller.dispose();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: const Text('ae')),
      body: Column(
        children: [
          Center(
              child: Lottie.asset(
            "assets/jsons/animate.json",
            animate: true,
            controller: _controller,
            onLoaded: (com) {
              _controller.duration = Duration(seconds: 10);
            },
          )),
          ElevatedButton(
              onPressed: () {
                _controller.forward();
              },
              child: Text("start")),
          ElevatedButton(
              onPressed: () {
                _controller.stop();
              },
              child: Text("stop"))
        ],
      ),
    );
  }
}
